1
bash
This demonstrates using a "here" document in Bash to create a Python script that interacts with stdout
, stderr
, and stdin
.
cat > hello.py << EOF #!/usr/bin/env python from __future__ import print_function import sys print("#stdout", file=sys.stdout) print("#stderr", file=sys.stderr) for line in sys.stdin: print(line, file=sys.stdout) EOF # Variables will be expanded if the first "EOF" is not quoted
bash internalfile and stream operationscontent operationshere-document (heredoc)